package com.ylbh.modules.businesscoupon.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ylbh.common.pojo.businesscoupon.dto.StoreCouponDTO;
import com.ylbh.common.pojo.member.vo.MemberVO;
import com.ylbh.modules.businesscoupon.entity.ShoppingStoreCoupon;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 *
 * 商家优惠券
 * @author czx
 * @date 2019-11-05 14:27:27
 */
@Mapper
@Repository
public interface ShoppingStoreCouponMapper extends BaseMapper<ShoppingStoreCoupon> {

    /**
     * 商家优惠券列表
     * @param dto
     * @param page
     * @return
     */
    List<ShoppingStoreCoupon> selectStoreCouponList(@Param(value = "dto") StoreCouponDTO dto, Page page);

    /**
     * 查看商家优惠券详情
     * @param id
     * @return
     */
    ShoppingStoreCoupon selectStoreCouponInfoById(String id);

    /**
     * 修改商家优惠券的审核状态
     * @param id
     * @param check
     * @param checkNoPass
     */
    void updateStoreCouponStatusById(String id, Integer check, String checkNoPass);

    /**
     * 优惠券审核不通过返还金额给用户
     * @param id
     */
    void updateRecommendMoneyById(String id, BigDecimal recommendMoney);

    /**
     * 查询用户现在金额
     * @param id
     * @return
     */
    BigDecimal selectRecommendMoneyByUserId(String id);

    /**
     * 查询用户信息
     * @param id
     * @return
     */
    MemberVO selectUserDetailsById(String id);

    /**
     * 增加日志信息
     * @param vo
     * @param date
     * @param userId
     * @param id
     */
    void insertBalanceLog(@Param(value = "vo") MemberVO vo, Date date, Long userId, String id, String couponId);
}
